import Book.BookList;
import User.AdminUser;
import User.NormalUser;
import User.User;


import java.util.Scanner;

public class main {

    public static User login() {
        var scan = new Scanner(System.in);
        System.out.println("请输入你的姓名:");
        String name = scan.nextLine();
        System.out.println("请选择你的身份:1、管理员   2、用户");
        int choise = scan.nextInt();

        if (choise == 1) {
            //管理员
            return new AdminUser(name);
        }else {
            //普通用户
            return new NormalUser(name);
        }
    }

    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = login();

        while (true) {
            int choise = user.menu();
            System.out.print("您选择了" + choise + ",");
            user.doOperation(choise,bookList);
        }
    }
}
